//
//  VVYRefreshTableView.m
//  viviyoo
//
//  Created by Jay_Apple on 15/11/9.
//  Copyright © 2015年 viviyoo. All rights reserved.
//

#import "VVYRefreshTableView.h"


@implementation VVYRefreshTableView

- (void)awakeFromNib
{
    self.tableFooterView = [[UIView alloc] init];
    
    self.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefreshMethod)];
    
    self.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefreshMethod)];
}

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style{

    if (self = [super initWithFrame:frame style:style]) {
        self.tableFooterView = [[UIView alloc] init];
        
        self.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefreshMethod)];
        
        self.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefreshMethod)];
    }
    return self;
}



#pragma mark - refresh方法

- (void)headerRefreshMethod{
    if ([self.delegate respondsToSelector:@selector(tableViewHeaderRefreshMethod:)]) {
        [self.delegate tableViewHeaderRefreshMethod:self];
    }
}

- (void)footerRefreshMethod{
    if ([self.delegate respondsToSelector:@selector(tableViewfooterRefreshMethod:)]) {
        [self.delegate tableViewfooterRefreshMethod:self];
    }
}

@end
